Public Class frmRename

    Public WriteOnly Property Pfad() As String
        Set(ByVal value As String)
            Me.txtPfad.Text = value
        End Set
    End Property

    Public WriteOnly Property OldName() As String
        Set(ByVal value As String)
            Me.txtOldName.Text = value
        End Set
    End Property

    Public ReadOnly Property NewObjectName() As String
        Get
            Return Me.txtNewName.Text
        End Get
    End Property

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        If Check() = True Then
            Me.DialogResult = Windows.Forms.DialogResult.OK
        End If
    End Sub

    Private Function Check() As Boolean
        Dim retB As Boolean = True
        If IsNothing(Me.txtPfad.Text) Then retB = False
        If IsDBNull(Me.txtPfad.Text) Then retB = False
        Return retB
    End Function

    Private Sub txtNewName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNewName.KeyPress
        If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) And Check() Then
            Me.DialogResult = Windows.Forms.DialogResult.OK
        End If
    End Sub


    Private Sub frmUmbenennen_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtNewName.Select()
    End Sub
End Class